package com.situ.day6;

import java.lang.String;

public class Student extends Person{
    private String className;

    public Student() {
        // new Person();
        // super();
        System.out.println("Student.Student1");
    }

    // this:代表当前类的对象
    // super():
    public Student(int id, String name, int age, String gender, String className) {
        // super();
        // Java里面new子类对象的时候，首先把父类对象new
        // new Person(id, name, age, gender);
        //super(id, name, age, gender);
        this.className = className;
        System.out.println("Student.Student2");
    }

    /*public Student(int id, String name, int age, String gender, String className) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.gender = gender;
        this.className = className;
    }*/

    // 'id' has private access in 'com.situ.day6.Person'
    public void  study() {
        System.out.println("id是"+id+"的"+name+"正在"+className+"班学习");
    }

    // 重写（覆盖）
    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", age=" + age +
                ", gender='" + gender + '\'' +
                ", className='" + className + '\'' +
                '}';
    }
}
